import request from '@/utils/request'

// 用户登录
export function login(username, password, captcha) {
  return request({
    url: '/auth/login',
    method: 'post',
    params: {
      username,
      password,
      captcha
    }
  })
}

// 用户注册
export function register(username, password, email) {
  return request({
    url: '/auth/register',
    method: 'post',
    params: {
      username,
      password,
      email
    }
  })
}

// 获取用户信息
export function getInfo() {
  return request({
    url: '/auth/info',
    method: 'get'
  })
}

// 修改密码
export function updatePassword(oldPassword, newPassword) {
  return request({
    url: '/auth/updatePassword',
    method: 'post',
    params: {
      oldPassword,
      newPassword
    }
  })
}

// 用户登出
export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCaptcha() {
  return request({
    url: '/captcha/generate',
    method: 'get'
  })
} 